package com.lanou.dllo.findfood.activity;

import android.content.Intent;
import android.os.Bundle;


import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TabHost;

import com.lanou.dllo.findfood.R;
import com.lanou.dllo.findfood.fragment.NewestFragment;
import com.lanou.dllo.findfood.fragment.SpecialFragment;

/**
 * Created by dllo on 15/10/26.
 * 晒厨艺
 */
public class BaskCookingActivity extends AppCompatActivity implements View.OnClickListener {
    private TabHost mHost;
    private FragmentManager fm;
    private ImageView Shai_back, baskCooking;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.fragement_shai);
        Shai_back = (ImageView) findViewById(R.id.Shai_back);
        Shai_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        mHost = (TabHost) findViewById(android.R.id.tabhost);
        mHost.setup();
        baskCooking = (ImageView) findViewById(R.id.baskCooking);
        baskCooking.setOnClickListener(this);


        TabHost.TabSpec tab1 = mHost.newTabSpec("search");
        tab1.setIndicator("精 选");
        tab1.setContent(R.id.fristView1);
        mHost.addTab(tab1);

        TabHost.TabSpec tab2 = mHost.newTabSpec("sec");
        tab2.setIndicator("最 新");
        tab2.setContent(R.id.secondView2);
        mHost.addTab(tab2);
        initFragemnt();


    }

    public void initFragemnt() {
        fm = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.fristView1, new SpecialFragment());
        ft.replace(R.id.secondView2, new NewestFragment());
        ft.commit();


    }

    //监听相机的按钮  访问本地通讯录,将图片显示到一个页面中,重选再次访问本地相册
    //在该页面点击下一步进行图片对象的传递,传递到,编辑页面,进行发布
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.baskCooking:
                Intent intent_chages = new Intent(this, ChoseImageActivity.class);
                startActivity(intent_chages);
                break;
            default:
                break;
        }


    }
}
